package com.njtoyo.taxi.admin.rest.controller.business;

import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.njtoyo.taxi.admin.rest.wrapper.business.company.AddCompanyWithdrawCantonWrapper;
import com.njtoyo.taxi.admin.rest.wrapper.business.company.AddCompanyWithdrawWrapper;
import com.njtoyo.taxi.admin.rest.wrapper.business.company.CompanyWithdrawCantonWrapper;
import com.njtoyo.taxi.admin.rest.wrapper.business.company.CompanyWithdrawWrapper;
import com.njtoyo.taxi.admin.service.business.ICompanyWithdrawCantonService;
import com.njtoyo.taxi.entity.backend.AdminUser;
import com.taxi.entity.common.RestResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

/**
 * <p>
 * 地区打款 前端控制器
 * </p>
 *
 * @author xyhang
 * @since 2024-07-23
 */
@RestController
@RequestMapping("business/company-withdraw-canton")
public class CompanyWithdrawCantonController {

    @Autowired
    ICompanyWithdrawCantonService companyWithdrawCantonService;
    @GetMapping("/list")
    public RestResult index(@ApiIgnore @ModelAttribute("admin") AdminUser adminUser, CompanyWithdrawCantonWrapper wrapper) {
        return companyWithdrawCantonService.getPage(adminUser, wrapper);
    }

    @PostMapping
    RestResult addWithdraw(@ApiIgnore @ModelAttribute("admin") AdminUser adminUser, @RequestBody AddCompanyWithdrawCantonWrapper add) {
        return companyWithdrawCantonService.addWithdraw(adminUser, add)>0?RestResult.success():RestResult.fail();
    }

    @PutMapping
    RestResult updateWithdraw(@ApiIgnore @ModelAttribute("admin") AdminUser adminUser, @RequestBody AddCompanyWithdrawCantonWrapper add) {
        return companyWithdrawCantonService.updateWithdraw(adminUser, add)>0?RestResult.success():RestResult.fail();
    }
}
